package com.huterox.todoscheduler.core.wapper;

import com.huterox.todoscheduler.core.enumType.TodoListElementType;
import com.huterox.todoscheduler.core.enumType.TodoListTempleCreateType;
import com.huterox.todoscheduler.handler.TodoListAfterHandler;
import com.huterox.todoscheduler.handler.TodoListBeforeCreateHandler;
import com.huterox.todoscheduler.handler.TodoListErrorHandler;

import java.io.Serializable;
import java.util.Comparator;
import java.util.Map;
import java.util.TreeMap;

/**
 * 对清单的简单封装，主要是给创建模板使用的
 * */
public class TodoListWrapper implements Serializable {

    private String todoListName;
    private TodoListElementType todoListElementType;
    //清单相关的处理器
    private TodoListErrorHandler todoListErrorHandler;
    private TodoListAfterHandler todoListAfterHandler;
    private TodoListBeforeCreateHandler todoListCreateCheckHandler;

    private TodoListTempleCreateType createType;
    private final Comparator<Integer> keyComparator = new Comparator<Integer>() {
        @Override
        public int compare(Integer key1, Integer key2) {
            // 根据键的大小进行比较
            return key1.compareTo(key2);
        }
    };
    private final Map<Integer, TodoItemMethodWrapper> sortedMap = new TreeMap<>(keyComparator);

    public TodoListErrorHandler getTodoListErrorHandler() {
        return todoListErrorHandler;
    }

    public void setTodoListErrorHandler(TodoListErrorHandler todoListErrorHandler) {
        this.todoListErrorHandler = todoListErrorHandler;
    }

    public TodoListAfterHandler getTodoListAfterHandler() {
        return todoListAfterHandler;
    }

    public void setTodoListAfterHandler(TodoListAfterHandler todoListAfterHandler) {
        this.todoListAfterHandler = todoListAfterHandler;
    }

    public TodoListBeforeCreateHandler getTodoListCreateCheckHandler() {
        return todoListCreateCheckHandler;
    }

    public void setTodoListCreateCheckHandler(TodoListBeforeCreateHandler todoListCreateCheckHandler) {
        this.todoListCreateCheckHandler = todoListCreateCheckHandler;
    }

    public Map<Integer, TodoItemMethodWrapper> getSortedMap() {
        return sortedMap;
    }



    public TodoListTempleCreateType getCreateType() {
        return createType;
    }

    public void setCreateType(TodoListTempleCreateType createType) {
        this.createType = createType;
    }

    public TodoListWrapper() {
    }

    public String getTodoListName() {
        return todoListName;
    }

    public void setTodoListName(String todoListName) {
        this.todoListName = todoListName;
    }

    public TodoListElementType getTodoListElementType() {
        return todoListElementType;
    }

    public void setTodoListElementType(TodoListElementType todoListElementType) {
        this.todoListElementType = todoListElementType;
    }

    public Comparator<Integer> getKeyComparator() {
        return keyComparator;
    }

    public Map<Integer, TodoItemMethodWrapper> getItemMethodMap() {
        return sortedMap;
    }
}
